import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int n = in.nextInt();
        String[] passwords = new String[n];
        for (int i = 0; i < n; i++) {
            passwords[i] = in.next();
        }
        String[] ret = new String[n];
        for (int i = 0; i < passwords.length; i++) {
            String password = passwords[i];
            if (password.length() < 8) {
                ret[i] = "Weak";
                continue;
            }
            boolean capital = false;
            boolean lower = false;
            boolean digital = false;
            boolean special = false;
            int type = 0;
            for (char c : password.toCharArray()) {
                if (c >= 'a' && c <= 'z') {
                    if (!lower) {
                        type++;
                        lower = true;
                    }
                } else if (c >= 'A' && c <= 'Z') {
                    if(!capital) {
                        type++;
                        capital = true;
                    }
                } else if (c >= '0' && c <= '9') {
                    if (!digital) {
                        type++;
                        digital = true;
                    }
                } else if (c >= 33 && c <= 126) {
                    if (!special) {
                        type++;
                        special = true;
                    }
                }
            }
            if (type == 4) {
                ret[i] = "Strong";
            } else if (type == 3) {
                ret[i] = "Medium";
            } else {
                ret[i] = "Weak";
            }
        }
        for (String s : ret) {
            System.out.println(s);
        }
    }
}
